# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgbase=libmesode
pkgname=('libmesode' 'libmesode-doc')
pkgver=0.10.1
pkgrel=2
pkgdesc='Simple, lightweight C library for writing prifanity XMPP client'
url='https://github.com/boothj5/libmesode'
arch=('loong64' 'x86_64')
license=('GPL3' 'MIT')
depends=('glibc' 'openssl' 'expat')
makedepends=('doxygen')
checkdepends=('check')
source=(https://github.com/boothj5/libmesode/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('00890ac903ed367872903242116527f229255bcc8988f87005b12a40a903d3b6133dff26229387c49de1ba6d911707adfc73a8a662864843899322c90e10dba7')
b2sums=('485ee7e431befadcee34a7c8535818f692d35f0b619784c95d19b9ab19b7b0fc25e64bdb0f50a89a2709386304b3bae724a3e66f1622bcb8cc2b290bed32fae5')

prepare() {
  cd ${pkgbase}-${pkgver}
  ./bootstrap.sh
}

build() {
  cd ${pkgbase}-${pkgver}
  ./configure --prefix=/usr
  make
  doxygen
}

check() {
  make -C ${pkgbase}-${pkgver} check
}

package_libmesode() {
  provides=('libmesode.so')
  depends+=('libexpat.so')
  cd ${pkgbase}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 MIT-LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

package_libmesode-doc() {
  pkgdesc+=' (documentation and samples)'
  depends=()
  options=('!strip')
  optdepends=('libmesode')
  cd ${pkgbase}-${pkgver}
  install -Dm 644 docs/html/* -t "${pkgdir}/usr/share/doc/${pkgname}/html"
  install -Dm 644 examples/{README.md,*.c} -t "${pkgdir}/usr/share/doc/${pkgname}/examples"
  install -Dm 644 MIT-LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
